import {reactive, ref} from "vue";

export function useTypes() {
    const types = reactive({
        text: '文稿',
        excel: '电子表格',
        ppt: '演示文稿',
        zip: '压缩包',
        voice: '音频',
        exec: '可执行文件',
        other: '其他',
    })
    let typeActive = ref('');

    function switchType(type:string) {
        if (!types.hasOwnProperty(type) || typeActive.value === type) {
            return;
        }

        typeActive.value = type;
    }

    return {typeActive, switchType, types};
}